<?php
include "includes/functions.php";    
$document = Unicode_Decode(FetchDataString("http://vnexpress.net/Vietnam/Khoa-hoc/2007/12/3B9FD9E3/")); 
     


$StrBegin = '<P class=Title>';
$StrEnd   = '<table border=0 cellpadding=0 cellspacing=0 width="100%">';

$PosBegin = strpos($document,$StrBegin);
$PosBegin = $PosBegin?$PosBegin:strpos($document,'<TABLE cellSpacing=0 cellPadding=3 width=1 align=left border=0>'); 
$PosEnd   = strpos ($document,$StrEnd);                    

if ($PosBegin == false || $PosEnd == false )
{
    echo "loi so 1";
    return false;
}

$document = substr($document,$PosBegin,$PosEnd-$PosBegin-24);
$document =  str_replace('src="','src="http://vnexpress.net'.$link,$Content); 

$ImgLink = trim(TextBetween('src="','"',$document));

$ImgLink = ''?$_SERVER['SERVER_NAME'].'/AutoCMS/images/no_images.gif':$ImgLink; 

$Title = TextBetween('<P class=Title>','</P>',$document);    
$Intro = trim(TextBetween('<P class=Lead>','</P>',$document));  

$PosBegin = strpos($document,$Intro) + strlen($Intro) + 4;
$PosEnd  = strrpos($document,'</P>') + 4;

if ($PosBegin == false || $PosEnd == false )
{
    echo "loi so 2";
    return false;
    

}
$Content = substr($document,$PosBegin,$PosEnd-$PosBegin);
$Content =  str_replace('src="','src="http://vnexpress.net'.$link,$Content);  

echo $ImgLink;
echo $Title . "<br>"; 
echo $Intro . "<br>";
echo $Content . "<br><br>";        
  





?>